package com.itheima.test02;

import com.sun.security.jgss.GSSUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test03 {
    public static void main(String[] args) {
        ArrayList<HashMap<String, String>> list = new ArrayList<>();
        HashMap<String, String> hm1 = new HashMap<>();
        HashMap<String, String> hm2 = new HashMap<>();
        HashMap<String, String> hm3 = new HashMap<>();
        hm1.put("张无忌", "赵敏");
        hm1.put("杨逍", "纪晓芙");
        hm2.put("郭靖", "黄蓉");
        hm2.put("杨过", "小龙女");
        hm3.put("孙策" , "大乔");
        hm3.put("周瑜" , "小乔");

        list.add(hm1);
        list.add(hm2);
        list.add(hm3);

//        list.get(0) = hm2;
        for (HashMap<String, String> hm : list) {
            Set<String> s = hm.keySet();
            for (String sKey : s) {
                System.out.println(sKey+","+hm.get(sKey));
            }
            System.out.println();
        }
        System.out.println("-------------------------------");

        for (HashMap<String, String> hm : list) {
            Set<Map.Entry<String, String>> pairs = hm.entrySet();
            for (Map.Entry<String, String> pair : pairs) {
                System.out.println(pair.getKey()+","+pair.getValue());
            }
            System.out.println();


        }









    }
}
